import React, { Component } from 'react'
import './index.css'
export default class index extends Component {
  render() {
    let { isFirst, isLoading, err, userData } = this.props
    if(isFirst){
        return <h1>初次加载，请输入关键字进行用户搜索！</h1>
    }else if(isLoading){
        return <h1>加载中...请稍候</h1>
    }else if(err){
        return <h1>出错了！{err}</h1>
    }else{
        return (
            <div className="row">
                {
                    userData.map(item=>{
                        return (
                            <div className="card" key={item.id}>
                                <a href={item.html_url} target="_blank" rel="noreferrer">
                                    <img src={item.avatar_url} alt="head_portrait" style={{width: '100px'}}/>
                                </a>
                                <p className="card-text">{item.login}</p>
                            </div>
                        )
                    })
                }
            </div>
        )
    }
  }
}
